#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
int main(void)
{
    pid_t id=fork();
    if(id==0)//子进程
    {
        printf("child process...\n");
        sleep(4);
        char* myenv[]=
        {
            "MYCESS=/project/proj_10.22/proj_2",
            "PATH=$PATH",
            NULL 
                
        };
        char* arg[]=
        {
            "mycess",
            NULL 
        };
        execve("./mycess",arg,myenv);
        exit(1);
    }
    else//父进程 
    {
        int status;
        printf("father process...\n");
        sleep(4);
        waitpid(id,&status,0);
        printf("exit code:%d\n",(status>>8)&0xFF);
        printf("signal:%d\n",status&0x7F);
    }
    return 0;
}
